<template>
  <div class="goods">
    <img v-lazy="item.show.img" width="100%" />
    <div class="title">{{ item.title }}</div>
    <div style="line-height: 20px">
      <span class="price">{{ item.price | priceFilter }}</span>
      <span>
        <i class="iconfont icon-shoucang1"></i>
        {{ item.cfav }}
      </span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: Object
  },
  filters: {
    priceFilter: (price) => '￥' + price.toFixed(2)
  }
}
</script>

<style lang="less" scoped>
.goods {
  background: white;
  box-sizing: border-box; /* 怪异盒子模型，可根据实际项目需要自行设置 */
  font-size: 12px;
  padding: 10px;
  width: 100%;
  text-align: center;
  img {
    border-radius: 10px;
  }
  .title {
    // word-break: break-all; /* 强制换行 */
    display: -webkit-box;
    -webkit-line-clamp: 1; /* 设置超过为省略的行数 */
    -webkit-box-orient: vertical; /* 设置方向 */
    overflow: hidden;
    line-height: 20px;
  }
  .price {
    color: red;
    margin-right: 10px;
  }
  .icon-shoucang1 {
    font-size: 12px;
  }
}
</style>
